<script type="text/html" data-template-name="rabbitmq-consumer">
    <div class="form-row">
        <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
        <input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
    </div>

    <div class="form-row">
        <label for="node-input-datasourceId"><i class="fa fa-globe"></i>
            <span>数据源</span></label>
        <select id="node-input-datasourceId">
        </select>
    </div>

    <div class="form-row">
        <label for="node-input-type"><i class="fa fa-filter"></i> 类型</label>
        <select id="node-input-type">
            <option value="direct">direct exchange</option>
            <option value="fanout">fanout exchange</option>
            <option value="headers">headers exchange</option>
            <option value="topic">topic exchange</option>
            <option value="queue">queue</option>
        </select>
    </div>

    <div class="form-row">
        <label for="node-input-exchange"><i class="fa fa-lock"></i> <span>exchange</span></label>
        <input type="text" id="node-input-exchange" placeholder="Exchange or Queue">
    </div>

    <div class="form-row auto-create-exchange">
        <label for="node-input-autoCreateExchange"><i class="fa fa-lock"></i> <span>自动创建</span></label>
        <input type="text" id="node-input-autoCreateExchange">
    </div>


</script>

<script type="text/javascript">
    (function () {

        RED.nodes.registerType('rabbitmq-consumer', {
            category: 'network',
            name: "订阅RabbitMQ",
            color: "#f4702a",
            defaults: {
                name: {value: ""},
                datasourceId: {  value: "",required: true},
                exchange: {
                    value: "", required: true
                },
                groupId: {
                    value: "", required: true
                }
            },
            inputs: 0,
            outputs: 1,
            icon: "rabbitmq.svg",
            label: function () {
                return this.name || "订阅RabbitMQ";
            },
            labelStyle: function () {
                return this.name ? "node_label_italic" : "";
            },
            oneditprepare: function () {

            },
            oneditsave: function () {

            }
        });
    })()
</script>
